Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cksum: fix error handling #6801

Merged
merged 1 commit into from
Oct 22, 2024
Merged

Conversation

Luv-Ray
Copy link
Contributor

@Luv-Ray Luv-Ray commented Oct 20, 2024

fixes #6796

Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/tail/assert is no longer failing!

Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/tail/assert is no longer failing!
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)

@@ -1344,3 +1344,40 @@ fn test_check_comment_leading_space() {
.stdout_contains("foo: OK")
.stderr_contains("WARNING: 1 line is improperly formatted");
}

#[cfg(not(windows))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not windows?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/uutils/coreutils/actions/runs/11424022765/job/31783927716#step:7:3602
seems that windows has a different logic and is guarded by another test

#[cfg(not(windows))]
let err_msg = "cksum: d: Is a directory\n";
#[cfg(windows)]
let err_msg = "cksum: d: Permission denied\n";

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please document this into the test ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link

GNU testsuite comparison:

GNU test failed: tests/timeout/timeout. tests/timeout/timeout is passing on 'main'. Maybe you have to rebase?
Congrats! The gnu test tests/tail/assert is no longer failing!
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)

Copy link
Contributor

@RenjiSann RenjiSann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fixup the second and third commits into the first one, for better readability after merge.
Other than that, LGTM 👍

Comment on lines +618 to +620
// if any incorrectly formatted line, show it
cksum_output(&res, status);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason for moving this up ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As shown in the code snippet in #6796 :

$ ../../../gnu/src/cksum -c CHECKSUM --ignore-missing
../../../gnu/src/cksum: dir: Is a directory
dir: FAILED open or read
../../../gnu/src/cksum: WARNING: 1 listed file could not be read
../../../gnu/src/cksum: CHECKSUM: no file was verified

warnings in cksum_output show up first, and CHECKSUM: no file was verified shows up later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, indeed 👍

/// Windows has a different logic and is guarded by [`test_check_directory_error`].
#[cfg(not(windows))]
#[test]
fn test_check_error_handling() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rename this test_check_failed_to_read, to be a bit more specific.

@cakebaker cakebaker merged commit c4160f2 into uutils:main Oct 22, 2024
68 checks passed
@cakebaker
Copy link
Contributor

Thanks @Luv-Ray and @RenjiSann !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cksum: error handling deviation from GNU
4 participants